import matplotlib
import numpy as np
from matplotlib import pyplot as plt, axes, font_manager
import random
import time

Zh_Font = matplotlib.font_manager.FontProperties(fname="../venv/include/SourceHanSansSC-Bold.otf")
x1 = []
y1 = []
for _ in range(100):
    x1.append(random.randint(1, 100))
    y1.append(random.randint(1, 100))
x1.sort(reverse=True)
y1.sort()
for i in range(30):
    time.sleep(0.2)
    print(i)
    # 画布大小
    plt.figure(figsize=(9, 7))

    # 数据准备
    x11 = []
    y11 = []
    for _ in range(100):
        x11.append(random.randint(1, 100 - i * 2))
        y11.append(random.randint(1, 100 - i * 2))
    x11.sort(reverse=True)
    y11.sort()

    # 画图
    plt.plot(x1, y1, x11, y11)

    # 标题、坐标轴步长、坐标轴标题
    plt.title("12", fontsize=15, fontproperties=Zh_Font)
    plt.xticks(np.arange(0, 101, 10), fontsize=15, fontproperties=Zh_Font)
    plt.yticks(np.arange(0, 101, 10), fontsize=15, fontproperties=Zh_Font)
    plt.xlabel("种群进化代数", fontsize=15, fontproperties=Zh_Font)
    plt.ylabel("平均适应度函数", fontsize=15, fontproperties=Zh_Font)

    # 展示
    plt.show()
    print(1)
    print(2)
    print(7)